In [1]:
from nustar_pysolar import planning, io
import astropy.units as u
import warnings
warnings.filterwarnings('ignore')
In [11]:
fname = io.download_occultation_times(outdir='../data/')
print(fname)
In [12]:
tlefile = io.download_tle(outdir='../data')
print(tlefile)
times, line1, line2 = io.read_tle_file(tlefile)
In [13]:
tstart = '2019-01-12T00:00:00'
tend = '2019-01-12T23:00:00'
orbits = planning.sunlight_periods(fname, tstart, tend)
We can more or less pick any angle that we want. But this angle has to be specified a little in advance so that the NuSTAR SOC can plan the "slew in" maneuvers. Below puts DET0 in the top left corner (north-east with respect to RA/Dec coordinates).
In [14]:
pa = planning.get_nustar_roll(tstart, 0)
print("NuSTAR Roll angle for Det0 in NE quadrant: {}".format(pa))
In [15]:
orbit1 = orbits[10].copy()
offset = [300, 195]*u.arcsec
midTime = (0.5*(orbit1[1] - orbit1[0]) + orbit1[0])
sky_pos = planning.get_skyfield_position(midTime, offset, load_path='../data', parallax_correction=True)
print("Orbit start: {} Orbit end: {}".format(orbit1[0].isoformat(), orbit1[1].isoformat()))
print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
print("")
In [16]:
orbit2 = orbits[11]
offset = [420, 195]*u.arcsec
midTime = (0.5*(orbit2[1] - orbit2[0]) + orbit2[0])
sky_pos = planning.get_skyfield_position(midTime, offset, load_path='../data', parallax_correction=True)
print("Orbit start: {} Orbit end: {}".format(orbit2[0].isoformat(), orbit2[1].isoformat()))
print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
print("")
In [9]:
# Just use the first orbit...or choose one. This may download a ton of deltat.preds, which is a known
# bug to be fixed.
# Orbit3: 1946-2048
# Per Karl, SAA time 2031-2047
# Trim mosaic to 1946-2031:
orbit = orbits[12].copy()
orbit[1] = orbit[1].replace(minute=31)
print(orbit)
planning.make_mosaic(orbit, make_regions=True, outfile='orbit3_mosaic.txt', write_output=True)
In [10]:
tstart = orbit[1]
tend = orbits[12][1]
offset = [480, 195]*u.arcsec
midTime = (0.5*(tend - tstart)) + tstart
sky_pos = planning.get_sky_position(midTime, offset)
print("Orbit start: {} Orbit end: {}".format(tstart, tend))
print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
print("")
In [13]:
# Just use the first orbit...or choose one. This may download a ton of deltat.preds, which is a known
# bug to be fixed.
# Orbit4: 2123-2225
# Per Karl, SAA time 2214-2230
# Trim mosaic to 2214-2230
orbit = orbits[13].copy()
orbit[1] = orbit[1].replace(minute=14)
print(orbit)
planning.make_mosaic(orbit, make_regions=True, outfile='orbit4_mosaic.txt', write_output=True)
In [16]:
tstart = orbit[1]
tend = orbits[13][1]
offset = [520, 195]*u.arcsec
midTime = (0.5*(tend - tstart)) + tstart
sky_pos = planning.get_sky_position(midTime, offset)
print("Orbit start: {} Orbit end: {}".format(tstart, tend))
print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
print("")
In [ ]: